<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>

<head>
    <title>Title</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <script src="/layui/layui.js"></script>
    <script src="/layui/jquery-3.6.0.min.js"></script>
    <script>
        $(function () {
            layui.use(['laypage', 'layer', 'form'], function () {
                var laypage = layui.laypage
                    , layer = layui.layer
                    , form = layui.form;
                //分组件
                laypage.render({
                    elem: 'pagesData'
                    , count: ${pageInfo.total}//总条数
                    , layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
                    , limit: ${pageInfo.pageSize}//分页数
                    , limits: [5, 10, 15]
                    , curr: ${pageInfo.pageNum}//当前页面
                    , jump: function (obj, first) {
                        //首次不执行
                        //                 if (!first) {
                        //                     if (obj.curr != ${ pageInfo.pageNum }) {
                        //             location.href = "/sysLog/findAll?page=" + obj.curr + "&limit=" + obj.limit + "&key=" + $("#sk").val() + "&value=" + $("#sv").val()
                        //         }else if (obj.limit != ${ pageInfo.pageSize }){
                        //         location.href = "/sysLog/findAll?page=1&limit=" + obj.limit + "&key=" + $("#sk").val() + "&value=" + $("#sv").val()
                        //     }
                        // }

                        if (!first) {
                            location.href = "/syslog/findAll?page=" + obj.curr + "&limit=" + obj.limit + "&username=" + $("#username").val() + "&url=" + $("#url").val();
                        }
                    }
                });
            });
        })

    </script>


</head>

<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>日志列表</legend>
</fieldset>
<div class="layui-bg-gray" style="padding: 0px;">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form class="layui-form" action="/syslog/findAll">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">用户名称</label>
                                <div class="layui-input-inline">
                                    <input id="username" type="text" name="username"
                                           placeholder="请输入用户名称" autocomplete="off" class="layui-input" value="${username}">
                                </div>
                                <label class="layui-form-label">权限地址</label>
                                <div class="layui-input-inline">
                                    <input id="url" type="text" name="url"
                                           placeholder="请输入资源URL" autocomplete="off" class="layui-input" value="${url}">
                                </div>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


                                <button class="layui-btn  ">
                                    <i class="layui-icon layui-icon-search"></i>查询
                                </button>
                            </div>




                        </div>
                    </form>
                </div>
            </div>
        </div>


        <!--数据列表-->
        <table id="dataList" class="layui-table">
            <thead>
            <tr>
                <th>ID</th>
                <th>访问时间</th>
                <th>访问用户</th>
                <th>访问IP</th>
                <th>资源URL</th>
                <th>执行时间</th>
                <th>访问方法所在类</th>
                <th>访问方法</th>

            </tr>
            </thead>
            <tbody>
            <c:forEach items="${pageInfo.list}" var="sysLog">
                <tr>
                    <td>${sysLog.id }</td>
                    <td>${sysLog.visitTimeStr }</td>
                    <td>${sysLog.username }</td>
                    <td>${sysLog.ip }</td>
                    <td>${sysLog.url }</td>
                    <td>${sysLog.executionTime }</td>
                    <td>${sysLog.className }</td>
                    <td>${sysLog.methodName }</td>

                </tr>
            </c:forEach>
            </tbody>
        </table>
        <!--分页-->
        <div id="pagesData"></div>

    </div>
</div>
</div>
</div>
</div>
</body>

</html>